Class ConnectedComponentsDFS

java.lang.Object
edu.claflin.finder.algo.Algorithm
edu.claflin.finder.algo.ConnectedComponentsDFS
All Implemented Interfaces:
Processable<Graph,Graph>

public class ConnectedComponentsDFS extends Algorithm
Processes a Graph searching for connected components by performing a depth first search.
  • Constructor Details

    • ConnectedComponentsDFS

      public ConnectedComponentsDFS(ArgumentsBundle bundle)
      Public constructor for initializing the DepthFirstTraversalSearch with default conditions.
      Parameters:
      bundle - the ArgumentsBundle containing the instantiation arguments.
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • process

      public ArrayList<Graph> process(Graph graph)
      Processes data.
      Finds most Subgraphs by performing a depth first search on the node tree. It is unknown if it finds all or only most of the subgraphs due to the nature of the algorithm. It is expected, however, that it would miss certain node groupings.
      Parameters:
      graph - the Graph object to search through.
      Returns:
      the ArrayList of Graph objects holding all found subgraphs.
    • getConnectedComponents

      private ArrayList<Graph> getConnectedComponents(Graph graph)
      Gets a list of this Graph's Connected Components. Uses Depth First Search Technique.
      Parameters:
      graph - the Graph to get Connected Components from.
      Returns:
      the list of this Graph's Connected Components
    • dfs

      private void dfs(Node n, List<Node> inodes, List<Node> onodes, List<Boolean> visited)
      Recursive dfs that stores the nodes of a connected component. Copyright (c) 2003, The JUNG Authors.
      Parameters:
      n - the starting node
      inodes - the nodes awaiting consideration
      onodes - the list of nodes already visited
      visited - the visited node lookup